<template>
  <el-form :model="form" label-width="120px">
 
                    <JmInput jmname="名称" v-model="form.title"></JmInput>

      
                    <JmInput type="img" jmname="图片" v-model="form.imageurl"></JmInput> 



                    <JmInput jmname="连接" v-model="form.linkurl"></JmInput>
                    <JmInput type="num"  jmname="权重" v-model="form.weigh"></JmInput>
	
                    <JmInput   type="datetime"   jmname="开始时间" v-model="form.effectime"></JmInput>
 			               <JmInput type="datetime" jmname="截止时间" v-model="form.expiretime" remark="当广告位类型是3代码广告的时候使用"></JmInput>
                    
 	
                    
                    <JmEnum jmname="跳转类型" v-model="form.target" :jv="{'_blank': '跳到新页面打开',   '_self': '当前页面打开',   '_top': '在整个窗口中打开',   '_parent': '在父集框架中打开'  }" jtype="3"  ></JmEnum>
 		
                    <el-form-item>
                      <el-button type="primary" @click="onSubmit">Create</el-button>
                    </el-form-item>
 
  </el-form>
  </template>
<script>
import JmInput from "../../../components/form/JmInput.vue";
import JmEnum from "../../../components/form/JmEnum.vue";
export default {
  components: { JmInput, JmEnum },
   data() {
    return {
         form: {
            code: "",
            createtime: "2019-03-13 11:26:49",
            effectime: 1552447600,
            expiretime: 1583983600,
            id: 11,
            imageurl: "/uploads/200311/1-200311205303493.jpg",
            linkurl: "#",
            target: "_blank",
            title: "定制",
            updatetime: "2019-03-19 17:01:20",
            weigh: 1,
            zone_id: 4,
               
            }, 
    };
  }, 

//在export default中添加即可不用管顺序
    watch: {
       //监听内容
       edit_id() { 
        this.getDataList();
      }
    },
    props: ['edit_id'],
     inject:['handleClose'],
     
  mounted() {
    this.getDataList();
  },
  methods: {
    // 配置信息列表初始化
    async getDataList() {
      try { 
      /*查看单条数据*/
        const find = await this.$api.getAdsfind({ids:this.edit_id}); 
        this.form=find;  
        // this.form.code=find.code; 
        // this.form.height=find.height; 
        // this.form.name=find.name; 
        // this.form.mark=find.mark; 
        // this.form.type=find.type; 
        // this.form.width=find.width; 
      } catch (error) { 
      }
    },
     async onSubmit() {
       const find =  await this.$api.editAds(this.form,this.edit_id);   
       this.$parent.$parent.$parent.$parent.handleClose(); 
    },
  },
};
 
</script>